package com.example.springbootmybatisplus.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.springbootmybatisplus.bean.User;
import com.example.springbootmybatisplus.mapper.UserMapper;
import com.example.springbootmybatisplus.service.UserService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lfh
 * @since 2022-11-19
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Override
    public List<User> selectUserList(User user) {
        List<User> list = lambdaQuery().like(user != null, User::getName, user.getName()).list();
        List<User> objects = new ArrayList<>(list.size());//提前控制长度
        return lambdaQuery().like(user!=null,User::getName,user.getName()).list();
    }
}
